//
//  GetUserInfoH5Plugh.m
//  PCDBank
//
//  Created by weipeng on 2019/5/6.
//  Copyright © 2019年 DK. All rights reserved.
//

#import "GetUserInfoH5Plugh.h"

#import "PCDLoginSession.h"
@implementation GetUserInfoH5Plugh

#define USER_UserLoginCountName @"UserLoginCountName"

- (void)handler:(id)data andContext:(PCDContext *)context ResponseCallback:(WVJBResponseCallback )responseCallback{
    //
    NSDictionary *dict = (NSDictionary *)data;
    
    NSString *strJson = @"";
    NSString *strCallBack = dict[@"success"];
    
    
    if ([PCDUtil logined]) {
        
        PCDLoginSession *session = [PCDUtil loginSession];
        NSDictionary *dict = @{@"userInfo":session.mj_keyValues};
        
        evaluateJavaScriptOnMainThread(self, strCallBack, [dict JSONRepresentation]);
        
    }else{
        
        NSString *phone = [PCDDataStorageMangerGet() cacheUDStringForKey:kUserMobilePhone];
        NSDictionary *dataDic = @{@"lastPhone":[PCDUtil safeString:phone]};
        evaluateJavaScriptOnMainThread(self, strCallBack, [dataDic JSONRepresentation]);
    }
}



@end
